package org.destiny.geocen;

import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;

public class ResourceUtil {

	private static Context applicationContext;
	private static AssetManager assetManager;

	public static void setApplicationContext(Context applicationContext) {
		ResourceUtil.applicationContext = applicationContext;
		assetManager = applicationContext.getAssets();
	}

	public static Bitmap getBitMap(int id, int scale) {
		Bitmap bitmap = ((BitmapDrawable) applicationContext.getResources().getDrawable(id)).getBitmap();
		Bitmap b2 = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth() * scale, bitmap.getHeight() * scale, false);
		System.out.println("b :"+bitmap.getWidth()+","+bitmap.getHeight());
		System.out.println("b2:"+b2.getWidth()+","+b2.getHeight());
		return b2;
	}
	
	public static Bitmap getBitMap(int id) {
		Bitmap bitmap = ((BitmapDrawable) applicationContext.getResources().getDrawable(id)).getBitmap();
		return bitmap;
	}

}
